package com.example.iccil.model.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum UserThirdPartyBindStatusEnum {

    IS_BIND("已绑定", 1),
    UN_BIND("未绑定", 0),
    UN_SAVE("首次通过三方登录", 2);

    private final String text;

    private final Integer status;

    UserThirdPartyBindStatusEnum(String text, Integer status) {
        this.text = text;
        this.status = status;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param status 枚举值的value
     * @return 枚举值
     */
    public static UserThirdPartyBindStatusEnum getUserThirdPartyBindStatusEnum(Integer status) {
        for (UserThirdPartyBindStatusEnum userThirdPartyBindStatusEnum : values()) {
            if (Objects.equals(userThirdPartyBindStatusEnum.getStatus(), status)) {
                return userThirdPartyBindStatusEnum;
            }
        }
        return null;
    }
}
